package com.hulk.dryad.manage.boot.injector.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hulk.dryad.manage.boot.injector.DataScopeService;
import com.hulk.dryad.persistence.injector.datascope.DataScope;
import com.hulk.dryad.persistence.injector.datascope.mapper.DataScopeMapper;

import java.util.List;

/**
 * Service 实现类（ 泛型：M 是 mapper 对象，T 是实体 ， PK 是主键泛型 ）
 *
 * @author hulk
 */
public class DataScopeServiceImpl<M extends DataScopeMapper<T>, T> extends SuperServiceImpl<M, T> implements DataScopeService<T> {


	@Override
	public List<T> listByScope(Wrapper<T> queryWrapper, DataScope scope) {
		return baseMapper.selectListByScope(queryWrapper,scope);
	}

	@Override
	public <E extends IPage<T>> E pageByScope(E page, Wrapper<T> queryWrapper, DataScope scope) {
		return baseMapper.selectPageByScope(page,queryWrapper,scope);
	}

	@Override
	public Integer countByScope(Wrapper<T> queryWrapper, DataScope scope) {
		return baseMapper.selectCountByScope(queryWrapper,scope);
	}

	@Override
	public Integer saveBatchSomeColumn(List<T> entityList) {
		return baseMapper.insertBatchSomeColumn(entityList);
	}
}
